package com.example.controller;

import com.example.entity.FacilityMaintainer;
import com.example.entity.Page.PageRequest;
import com.example.result.CommonResult;
import com.example.service.FacilityMaintainerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: tobed
 * @date: 2022/11/15
 * @time: 10:01
 */
@RestController
@RequestMapping("facilityMaintainer")
public class FacilityMaintainerController {

    @Autowired
    FacilityMaintainerService facilityMaintainerService;

    /*维修记录全查*/
    @GetMapping("list")
    public CommonResult list(FacilityMaintainer facilityMaintainer, PageRequest pageRequest){
        CommonResult commonResult = facilityMaintainerService.list(facilityMaintainer,pageRequest);
        return commonResult;
    }

    /*删除维修记录*/
    @PostMapping("remove/{id}")
    public CommonResult remove(@PathVariable Integer id){
        CommonResult commonResult = facilityMaintainerService.remove(id);
        return commonResult;
    }

    /*添加设备维修记录*/
    @PostMapping("create")
    public CommonResult create(@RequestBody FacilityMaintainer facilityMaintainer){
        CommonResult commonResult = facilityMaintainerService.create(facilityMaintainer);
        return commonResult;
    }

    /*审核*/
    @PostMapping("over")
    public CommonResult over(@RequestBody FacilityMaintainer facilityMaintainer){
        CommonResult commonResult = facilityMaintainerService.over(facilityMaintainer);
        return commonResult;
    }

}
